var path = window.location.href;
var orderId = path.substring(path.indexOf("=") + 1,path.indexOf("&"));
var goodId = path.substring(path.lastIndexOf("=") + 1);
console.log(goodId);
var token=localStorage.getItem("key");
var content=$("#content").val();

$.ajax({
	type:"get",
	url:"/api/me/getMyOrderDetail",
	async:true,
	data:{"token":token,"orderId":orderId},
	dataType:"json",
	success:function(data){
		var list = data.data.goods;
		var str="";
		for (var i=0;i<list.length;i++) {
		
			str += '<a href="#" target="_blank" class="item-d-img">'+
						'<img src="'+list[i].imgUrl+'">'+
					'</a>'+
					'<div class="item-title">'+
						'<a href="../home/introduction?id='+list[i].goodsId+'" target="_blank" title="'+list[i].goodsName+'">'+list[i].goodsName+'</a>'+
					'</div>'+
					'<div class="sku">商品规格'+list[i].goodsStandard+'</div>';
		}
		$('.item-detail').html(str);
	}
});


function addComment(){
	$.ajax({
		type:"post",
		url:"/api/me/evaluateOrder",
		async:true,
		data:JSON.stringify({"data":{
				"token":token,
				"orderId":orderId,
				"goods":[{
					"goodsId":goodId,
					"content":content,
				}]
			}
		}),
		dataType:"json",
		success:function(data){
			window.location.href="order.html";
			console.log(data);
		}
	});
}
